package com.ytf.test.eighth;

class Glyph{
    void draw(){
        System.out.println("Glyph.draw()");
    }

    public Glyph() {
        System.out.println("Glyph() before draw()");
        draw();
        System.out.println("Glyph() after draw()");
    }
}
class RoundGlyph extends Glyph{
    private int radius=1;

    public RoundGlyph(int radius) {
        // draw(); //RoundGlyph.draw() , radius = 1
        this.radius = radius;
        System.out.println("RoundGlyph.RoundGlyph() , radius = "+radius);
    }

    @Override
    void draw() {
        System.out.println("RoundGlyph.draw() , radius = "+radius);
    }
}
/**
 * @author: YTF
 * @date: 2025/1/25 8:52
 * @version: 1.0
 * @description:
 */
public class PolyConstructors {
    public static void main(String[] args) {
        new RoundGlyph(5);
        /**
         * Output:
         * Glyph() before draw()
         * RoundGlyph.draw() , radius = 0
         * Glyph() after draw()
         * RoundGlyph.RoundGlyph() , radius = 5
         *
         * 注意： draw方法让覆盖 但输出不是1而是0
         * 原因是在其他任何事物发生之前，将分配给对象的储存空间初始化成二进制的零。所以这里还没有进行赋值
         */
    }
}
